SPB Git forge

spb/toveli

Public
14commits 1branches 0releases
1.1 MBsize
maindefault branch
5 h agolast push
TypeScript 50.6% JavaScript 46.1% SQL 2.1% Shell 0.6% CSS 0.5%
910 B · 11 lines tsx
Raw Blame History
1import { notFound } from "next/navigation";2import { requireUser } from "@/lib/auth/session";3import { getThread } from "@/lib/inquiries/service";4import { ThreadView } from "./thread-view";5export const dynamic = "force-dynamic";6export default async function Thread({ params }: { params: Promise<{ id: string }> }) {7  const u = await requireUser(); const { id } = await params;8  let t; try { t = await getThread(id, u.id); } catch { notFound(); }9  return <ThreadView t={{ inquiry: { id: t.inquiry.id, status: t.inquiry.status, category: t.inquiry.category, recipientUserId: t.inquiry.recipientUserId }, listing: t.listing ? { slug: t.listing.slug, title: t.listing.title, status: t.listing.status } : null, other: t.other, me: t.me, messages: t.messages.map((m) => ({ id: m.id, senderId: m.senderId, body: m.body, createdAt: m.createdAt.toISOString(), readAt: m.readAt?.toISOString() ?? null })) }} />;10}11